
#ifndef PARTTERN_CRTP_H
#define PARTTERN_CRTP_H

#include <iostream>

// 奇异递归继承
template<typename Derived>
struct Graph {
    auto draw() const {
        auto &self = *static_cast<Derived *>(this);
        return self.draw();
    }
};

struct Circle : Graph<Circle> {
    float radius;

    void draw() const {
        std::cout << "draw circle\n";
    }
};


#endif //PARTTERN_CRTP_H
